#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Converting holo-black to holo-dark and holo-light
'''

import os, sys

print("Python version: " + sys.version)
print(__doc__)

SKIN_XML = 'skin.xml'
MAIN_SKIN = 'holo-black'
dark = {
            'path':'holo-dark',
            'changes':
            (
            ('holo-black', 'holo-dark'),
            ('color name="4thFG" value="#00bbbbbb"', 'color name="4thFG" value="#00777777"'),
            ('color name="background" value="#00000000"', 'color name="background" value="#00252525"'),
            )
        }
light = {
            'path':'holo-light',
            'changes':
            (
            ('holo-black', 'holo-light'),
            ('color name="4thFG" value="#00bbbbbb"', 'color name="4thFG" value="#00777777"'),
            ('color name="background" value="#00000000"', 'color name="background" value="#00f0f0f0"'),
			('color name="foreground" value="#00ffffff"', 'color name="foreground" value="#00000000"'),
            )
         }

SKINS = (dark, light)

for changes in SKINS:
    skin_dir = changes['path']
    print(skin_dir)
    skin_main = open(os.path.join(MAIN_SKIN, SKIN_XML), 'rb')
    skin_new = open(os.path.join(skin_dir, SKIN_XML), 'wb')
    for nline in skin_main:
        for ch in changes['changes']:
            nline = nline.replace(ch[0].encode('utf-8'), ch[1].encode('utf-8'))
        skin_new.write(nline)

    skin_main.close()
    skin_new.close()
